#!/bin/bash
echo " "
echo "=============================================="
echo "method "$3" for matrix "$1" with ILU level "$2" and nvectors "$4 
echo "=============================================="
echo " "
STARTtime=$(date +%s%N)
./ilu --method $3 --file $1 --tolerance 1.e-10 --ilu-level $2 --nvectors $4
ENDtime=$(date +%s%N)
./ilu --method $3 --file $1 --tolerance 1.e-10 --ilu-level $2 --nvectors $4 > "temp"$4$3$2$1".txt"
CPUTIME=$(tail -1 "temp"$4$3$2$1".txt")
CPUTIME=$(grep -o "[0-9]\{1,3\}\.[0-9]\{1,3\}" <<<"$CPUTIME")
DIFF=$((($ENDtime - $STARTtime)/1000000))
#echo $DIFF" "$CPUTIME" method "$3" for matrix "$1" with ILU level "$2  >> timings.txt
echo "method "$3" for matrix "$1" with ILU level "$2" and nvectors "$4  >> names.txt
echo $DIFF" "$CPUTIME >> timings.txt
mv ""$3".report" "reports/"$3"/"$3"["$4"].report"$2"["$1"]"
